/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.suarte.core.service.impl;

import com.suarte.core.Company;
import com.suarte.core.Contact;
import com.suarte.core.Quotation;
import com.suarte.core.QuotationDetail;
import com.suarte.core.QuotationStatus;
import com.suarte.core.dao.QuotationDao;
import com.suarte.core.service.QuotationManager;
import java.util.Date;
import org.appfuse.service.impl.GenericManagerImpl;

import java.util.List;

/**
 * @date   Dec 20, 2010
 * @author Ggutierrez
 */
public class QuotationManagerImpl extends GenericManagerImpl<Quotation, Long> implements QuotationManager {
    QuotationDao quotationDao;

    public QuotationManagerImpl(QuotationDao quotationDao) {
        super(quotationDao);
        this.quotationDao = quotationDao;
    }

    public List<Quotation> findByDescription(String description) {
        return quotationDao.findByDescription(description);
    }

    public void store(Quotation object) {
        quotationDao.store(object);
    }

    @Override
    public Quotation get(Long id) {
        return quotationDao.get(id);
    }

    public void deleteDetails(List<QuotationDetail> args) {
        quotationDao.deleteDetails(args);
    }

    public void approve(Quotation object) {
        object.setStatus(QuotationStatus.APROBADA);
        quotationDao.save(object);
    }

    public List<Quotation> findQuotations(Long id, String description, Date date, Company company, Contact contact, QuotationStatus status) {
        return quotationDao.findQuotations(id, description, date, company, contact, status);
    }
}
